Port to work in the Arduino environment.
